<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0"
	xmlns="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:mu="http://rdr.unimelb.edu.au/schema/murifcs"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rifcs="http://ands.org.au/standards/rif-cs/registryObjects"
	xmlns:ands="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#"
	xmlns:bibo="http://purl.org/ontology/bibo/"
	xmlns:foaf="http://xmlns.com/foaf/0.1/"
	xmlns:dcterms="http://purl.org/dc/terms/"
	xmlns:vivo="http://vivoweb.org/ontology/core#"
	xmlns:skos="http://www.w3.org/2004/02/skos/core#"
	xmlns:event="http://purl.org/NET/c4dm/event.owl#"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:m2r="http://www.versi.edu.au/projects/dc3/murifcs2rdf"
	exclude-result-prefixes="xsl xsi mu bibo foaf dcterms skos event ands">
		
	<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
	

	<!--
	    Map of rifcs:subject/@types to corresponding vivo:subjectArea/@resource prefixes
	    
	    NOTE:
	     - types not listed here are discarded during transformation:
	       they will not appear in the resultant RDF
	       
	       eg. if mapping isn't supplied for <rifcs:subject type='local'>, then
	           all 'local' <rifcs:subject>s are discarded
	-->				
	<xsl:variable name="type2prefix">				
		<m2r:map rifcsSubjectType="ANZSRC-FOR"  vivoPrefix="http://purl.org/asc/1297.0/2008/for/"/>
		<m2r:map rifcsSubjectType="ANZSRC-RFCD" vivoPrefix="http://purl.org/asc/1297.0/1998/rfcd/"/>
		<m2r:map rifcsSubjectType="ANZSRC-SEO"  vivoPrefix="http://purl.org/asc/1297.0/2008/seo/"/>
	</xsl:variable>
    
    <xsl:param name="RDF_OBJECT_ID_PREFIX">http://dc3central.versi.edu.au/vivo/individual/</xsl:param>
	
	
	<xsl:template match="mu:root">
		<rdf:RDF>
			<xsl:variable name="dataSource" select="'University of Melbourne'"/>	
			<xsl:variable name="groupDesc" select="@fromLab"/>
			
			<!-- 
				
				Collection Fragment
				
			-->
			<xsl:for-each select="./mu:rifcsData/rifcs:collection">
				
				<!-- type, dataSource, group and unique key fields are mandatory -->
				
				<xsl:variable name="collType" select="@type"/>
				<!-- @type can be "collection", "dataset", "repository", "catalogueOrIndex", "registry"  -->
				
				<xsl:variable name="dateModified" select="@dateModified"/>
				<xsl:call-template name="dateTime">
					<xsl:with-param name="dateModified"><xsl:value-of select="$dateModified"/></xsl:with-param>
				</xsl:call-template>
				<!-- date must be in YYYY-MM-DDThh:mm:ssZ format  -->
				
				<xsl:variable name="dateAccessioned" select="@dateAccessioned"/>
				<!-- date must be in YYYY-MM-DDThh:mm:ssZ format  -->
				
				<rdf:Description>
				    <xsl:attribute name="rdf:about" select="concat(
				        $RDF_OBJECT_ID_PREFIX,
				        $groupDesc,
				        '/collection/',
				        rifcs:identifier[@type='local'][1])"/>
				    <ands:harvestedBy
				        xmlns:ands="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#"
				        rdf:resource="https://rdr.unimelb.edu.au/vivo/individual/n5820"/>
				    
					<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ResearchData"> </rdf:type>
					<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing" /> 
					
					<xsl:choose>
						<xsl:when test="$collType='catalogueOrIndex'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ResearchCatalog"/> 
						</xsl:when>
						<xsl:when test="$collType='collection'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ResearchCollection"/> 
						</xsl:when>
						<xsl:when test="$collType='registry'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ResearchRegistry"/> 
						</xsl:when>
						
						<xsl:when test="$collType='repository'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ResearchRepository"/> 
						</xsl:when>
						<xsl:when test="$collType='dataset'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#researchDataset"/> 
						</xsl:when>
					</xsl:choose>
					
					<rdf:type rdf:resource="http://vivoweb.org/ontology/core#InformationResource"/>
					
						
					
					<ands:groupDescription>
						<xsl:apply-templates select="$groupDesc"/>
					</ands:groupDescription>
					
					
					<!--
						<rdf:Description rdf:about="{$rdfAbout}"/>
					-->
					
					
					<!--  Collection Name/Title -->
					<xsl:for-each select="rifcs:name">
						<xsl:call-template name="rifcs:name" />
					</xsl:for-each>
					
					<!--  Collection Descriptions -->
					<xsl:for-each select="rifcs:description">
						<xsl:call-template name="rifcs:description" />
					</xsl:for-each>
					
					<!--  Collection Identifiers -->
					<xsl:for-each select="rifcs:identifier">
						<xsl:call-template name="rifcs:identifier" />
					</xsl:for-each>
					
					<!--  Collection Locations -->
					<xsl:for-each select="rifcs:location">
						<xsl:call-template name="rifcs:location" />
					</xsl:for-each>
					
					<!--  Collection Related Objects -->
					<xsl:for-each select="rifcs:relatedObject">
						<xsl:call-template name="rifcs:relatedObject" />
					</xsl:for-each>
					
					<!--  Collection Subjects -->
					<xsl:apply-templates select="rifcs:subject"/>
										
					<!--  Collection Coverage -->
					<xsl:for-each select="rifcs:coverage">
						<xsl:call-template name="rifcs:coverage" />
					</xsl:for-each>
					
					<!--
						<electronic_address_type>
						<xsl:value-of select="rifcs:location/*/@type"/>
						</electronic_address_type>
					-->
					
					<!--  Collection RelatedInfo -->
					<xsl:for-each select="rifcs:relatedInfo">
						<!--
							<relatedInfo>
							<xsl:value-of select="rifcs:identifier"/>
							
							<type><xsl:value-of select="//rifcs:identifier//rifcs:identifier@type" /></type>
							
							</relatedInfo>
							
						-->
						<xsl:call-template name="rifcs:relatedInfo" />
					</xsl:for-each>
					
					
				</rdf:Description>
			</xsl:for-each>
			
			
			<!--  -->
			
			
			<!-- 
				
				Service Fragment
				http://ands.org.au/guides/cpguide/cpgservice.html
			-->
			
			
			<xsl:for-each select="./mu:rifcsData/rifcs:service">
				<xsl:variable name="serviceType" select="@type"/>
				<xsl:variable name="dateModified" select="@dateModified"/>
				<xsl:call-template name="dateTime">
					<xsl:with-param name="dateModified"><xsl:value-of select="$dateModified"/></xsl:with-param>
				</xsl:call-template>
				<xsl:variable name="dateAccessioned" select="@dateAccessioned"/>
				
				
				<!-- Type:
					
					Creation & Metadata Services
					
					'create'  -> produces a new data object representing existing phenomena in the world, including physical reality and user input. An instrument creates data.
					,'generate', -> produces a new data object out of mathematical formulae and parameters, rather than capturing and representing existing data in the world. A simulator generates data. (The simulation is the generated data.) A random number generator generates data.
					'report',  -> presents existing data in a summary form. A visualisation reports on data.
					'annotate',  ->  links an annotation to a data object, or part thereof.
					'transform',  -> changes a data object into a new data object, with a distinct format. An analysis tool creates a new data object out of data (either raw data, or other analyses).
					'assemble',  -> builds a new data object instance composed of existing data objects. A survey generation tool creates a survey form out of user input and templates.
					
					
					Discovery Services
					
					'harvest-oaipmh', -> (OAI-PMH Harvest —Open Archives Initiative Protocol for Metadata Harvesting. See also http://www.openarchives.org/
					'search-http' ->  Search service over HTTP. RFC2616
					'search-opensearch' ->   OpenSearch search—a collection of technologies that allow publishing of search results in a format suitable for syndication and aggregation
					'search-sru' ->  SRU search-SRU is a standard XML-focused search protocol for Internet search queries based on Z39.50 semantics.
					'search-srw' ->  SRW search-SRU VIA HTTP SOAP ('SRU via HTTP SOAP ' is the former SRW). SRW/U is being deployed as the search API for the DSpace initiative. It is being considered as the standard search API by a number of communities, including the meta-searching and geospatial searching communities.
					'search-z3950' ->  z39.50 search-the International Standard, ISO 23950: Information Retrieval (Z39.50): Application Service Definition and Protocol Specification, (also ANSI/NISO Z39.50). The standard specifies a client/server-based protocol for searching and retrieving information from remote databases.
					'syndicate-atom' -> ATOM syndication —an XML-based Web content and metadata syndication format. http://tools.ietf.org/html/rfc4287
					'syndicate-rss' ->  RSS feed—a family of web feed formats that are specified using XML.
					
					
				-->
				<rdf:Description>
				    <xsl:attribute name="rdf:about" select="concat(
				        $RDF_OBJECT_ID_PREFIX,
				        $groupDesc,
				        '/service/',
				        rifcs:identifier[@type='local'][1])"/>
				    <ands:harvestedBy
				        xmlns:ands="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#"
				        rdf:resource="https://rdr.unimelb.edu.au/vivo/individual/n5820"/>				    				    
				    
					<xsl:choose>
						<!--  instrument -->
						<xsl:when test="$serviceType='create'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceCreate"/> 
						</xsl:when>
						<!--  simulator -->
						<xsl:when test="$serviceType='generate'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceGenerate"/> 
						</xsl:when>
						
						<!--  visualisation, summary -->
						<xsl:when test="$serviceType='report'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceReport"/> 
						</xsl:when>
						
						<xsl:when test="$serviceType='annonate'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceAnnotate"/> 
						</xsl:when>
						
						<!--   analysis, conversion -->
						<xsl:when test="$serviceType='transform'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceTransform"/> 
						</xsl:when>
						
						<!--    aggregation -->
						<xsl:when test="$serviceType='assemble'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceAssemble"/> 
						</xsl:when>
						
						<!--   OAI-PMH Harvest -->
						<xsl:when test="$serviceType='harvest-oaipmh'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceHarvest-oaipmh"/> 
						</xsl:when>
						
						<!--  Search service over HTTP -->
						<xsl:when test="$serviceType='search-http'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceSearch-http"/> 
						</xsl:when>
						
						<!--   OpenSearch search -->
						<xsl:when test="$serviceType='search-opensearch'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceSearch-opensearch"/> 
						</xsl:when>
						
						<!--  SRU Search -->
						<xsl:when test="$serviceType='search-sru'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceSearch-sru"/> 
						</xsl:when>
						
						<!--  SRW Search -->
						<xsl:when test="$serviceType='search-srw'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceSearch-srw"/> 
						</xsl:when>
						
						<!--  z39.50 search -->
						<xsl:when test="$serviceType='search-z3950'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceSearch-z3950"/> 
						</xsl:when>
						
						<!--   ATOM syndication -->
						<xsl:when test="$serviceType='search-atom'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceSearch-atom"/> 
						</xsl:when>
						
						<!-- RSS feed -->
						<xsl:when test="$serviceType='search-rss'">
							<rdf:type rdf:resource="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#ServiceSearch-rss"/> 
						</xsl:when>
						
						
					</xsl:choose>
					
					
					<!--  Service Name/Title -->
					<xsl:for-each select="rifcs:name">
						<xsl:call-template name="rifcs:name" />
					</xsl:for-each>
					
					<!--  Service Descriptions -->
					<xsl:for-each select="rifcs:description">
						<xsl:call-template name="rifcs:description" />
					</xsl:for-each>
					
					<!--  Service Identifiers -->
					<xsl:for-each select="rifcs:identifier">
						<xsl:call-template name="rifcs:identifier" />
					</xsl:for-each>
					
					<!--  Service Locations -->
					<xsl:for-each select="rifcs:location">
						<xsl:call-template name="rifcs:location" />
					</xsl:for-each>
					
					<!--  Service Related Objects -->
					<xsl:for-each select="rifcs:relatedObject">
						<xsl:call-template name="rifcs:relatedObject" />
					</xsl:for-each>
					
					<!--  Service Subjects -->
					<xsl:apply-templates select="rifcs:subject"/>
										
					<!--  Service Coverage -->
					<xsl:for-each select="rifcs:coverage">
						<xsl:call-template name="rifcs:coverage" />
					</xsl:for-each>
					
					<!--  Service RelatedInfo -->			
					<xsl:for-each select="rifcs:relatedInfo">
						<xsl:call-template name="rifcs:relatedInfo" />
					</xsl:for-each>
					
					<!--  Service Access Policy -->
					<xsl:for-each select="rifcs:accessPolicy">
						<xsl:call-template name="rifcs:accessPolicy" />
					</xsl:for-each>
					
					<!--
						<xsl:call-template name="dateTime">
						<xsl:with-param name="publicationDate">$publicationDate</xsl:with-param>
						<xsl:with-param name="available">$available</xsl:with-param>
						<xsl:with-param name="created">$created</xsl:with-param>
						<xsl:with-param name="date">$date</xsl:with-param>
						<xsl:with-param name="dateAccepted">$dateAccepted</xsl:with-param>
						<xsl:with-param name="dateSubmitted">$dateSubmitted</xsl:with-param>
						<xsl:with-param name="endPublicationDate">$endPublicationDate</xsl:with-param>
						<xsl:with-param name="dateIssued">$dateIssued</xsl:with-param>
						<xsl:with-param name="dateModified">$dateModified</xsl:with-param>
						<xsl:with-param name="startPublicationDate">$startPublicationDate</xsl:with-param>
						<xsl:with-param name="dateVaild">$dateVaild</xsl:with-param>
						</xsl:call-template>
					-->
				</rdf:Description>
				
			</xsl:for-each>
			
			
			<!-- 
				
				Party Fragment
				
			-->
			
			
			<xsl:for-each select="./mu:rifcsData/rifcs:party">
				<xsl:variable name="partyType" select="@type"/>
				<xsl:variable name="dateModified" select="@dateModified"/>
				<xsl:call-template name="dateTime">
					<xsl:with-param name="dateModified"><xsl:value-of select="$dateModified"/></xsl:with-param>
				</xsl:call-template>
				<xsl:variable name="dateAccessioned" select="@dateAccessioned"/>
				
				<rdf:Description>
				    <xsl:attribute name="rdf:about" select="concat(
				        $RDF_OBJECT_ID_PREFIX,
				        $groupDesc,
				        '/party/',
				        rifcs:identifier[@type='local'][1])"/>
				    <ands:harvestedBy
				        xmlns:ands="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#"
				        rdf:resource="https://rdr.unimelb.edu.au/vivo/individual/n5820"/>
				    
					
					<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Agent"> </rdf:type>
					<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing" /> 
					
					
					<xsl:choose>
						<!--   one or more persons acting as a family, group, association, partnership or corporation -->
						<xsl:when test="$partyType='group'">
							<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Organization"> </rdf:type>
						</xsl:when>
						
						<!--    human being or identity assumed by one or more human beings -->
						<xsl:when test="$partyType='person'">
							<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"> </rdf:type>
						</xsl:when>
						
						
					</xsl:choose>
				
					
					<!--  Party Names/Title -->
					<xsl:for-each select="rifcs:name">
						<xsl:call-template name="rifcs:name" />
					</xsl:for-each>
					
					<!--  Party Descriptions -->
					<xsl:for-each select="rifcs:description">
						<xsl:call-template name="rifcs:description" />
					</xsl:for-each>
					
					<!--  Party Identifiers -->
					<xsl:for-each select="rifcs:identifier">
						<xsl:call-template name="rifcs:identifier" />
					</xsl:for-each>
					
					<!--  Party Locations -->
					<xsl:for-each select="rifcs:location">
						<xsl:call-template name="rifcs:location" />
					</xsl:for-each>
					
					<!--  Party Related Objects -->
					<xsl:for-each select="rifcs:relatedObject">
						<xsl:call-template name="rifcs:relatedObject" />
					</xsl:for-each>
					
					<!--  Party Subjects -->
					<xsl:apply-templates select="rifcs:subject"/>
										
					<!--  Party Coverage -->
					<xsl:for-each select="rifcs:coverage">
						<xsl:call-template name="rifcs:coverage" />
					</xsl:for-each>
					
					<!--  Party Related Info -->
					<xsl:for-each select="rifcs:relatedInfo">
						<xsl:call-template name="rifcs:relatedInfo" />
					</xsl:for-each>
					
					
					
				</rdf:Description>
				
			</xsl:for-each>
			
			
			<!-- 
				
				Activity Fragment
				
			-->
			
			<xsl:for-each select="./mu:rifcsData/rifcs:activity">
				<xsl:variable name="activityType" select="@type"/>
				<xsl:variable name="dateModified" select="@dateModified"/>
				<xsl:call-template name="dateTime">
					<xsl:with-param name="dateModified"><xsl:value-of select="$dateModified"/></xsl:with-param>
				</xsl:call-template>
				<xsl:variable name="dateAccessioned" select="@dateAccessioned"/>
				
				<rdf:Description>
				    <xsl:attribute name="rdf:about" select="concat(
				        $RDF_OBJECT_ID_PREFIX,
				        $groupDesc,
				        '/activity/',
				        rifcs:identifier[@type='local'][1])"/>
				    <ands:harvestedBy
				        xmlns:ands="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#"
				        rdf:resource="https://rdr.unimelb.edu.au/vivo/individual/n5820"/>
					
					
					<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Agent">
					</rdf:type>
					<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing" /> 
					
					<xsl:choose>
						
						<!--       something given to recognize excellence in a certain fields -->
						<xsl:when test="$activityType='award'">
							<rdf:type rdf:resource="http://vivoweb.org/ontology/core#Award"> </rdf:type>
						</xsl:when>	
						
						<!--      education imparted in a series of lessons or meetings -->
						<xsl:when test="$activityType='course'">
							<rdf:type rdf:resource="http://vivoweb.org/ontology/core#Course"> </rdf:type>
						</xsl:when>	
						
						<!--     something that happens at a particular place or time as an organized activity with participants or an audience -->
						<xsl:when test="$activityType='event'">
							<rdf:type rdf:resource="http://vivoweb.org/ontology/core#Event"> </rdf:type>
						</xsl:when>			
						
						
						<!--    piece of work that is undertaken or attempted, with a start and end date and defined objectives -->
						<xsl:when test="$activityType='program'">
							<rdf:type rdf:resource="http://vivoweb.org/ontology/core#Program"> </rdf:type>
						</xsl:when>
						
						
						<!--    piece of work that is undertaken or attempted, with a start and end date and defined objectives -->
						<xsl:when test="$activityType='project'">
							<rdf:type rdf:resource="http://vivoweb.org/ontology/core#Project"> </rdf:type>
						</xsl:when>
						
					</xsl:choose>
					
					
					<!--  Activity Name/Title -->
					<xsl:for-each select="rifcs:name">
						<xsl:call-template name="rifcs:name" />
					</xsl:for-each>
					
					<!--  Activity Descriptions -->
					<xsl:for-each select="rifcs:description">
						<xsl:call-template name="rifcs:description" />
					</xsl:for-each>
					
					<!--  Activity Identifiers -->
					<xsl:for-each select="rifcs:identifier">
						<xsl:call-template name="rifcs:identifier" />
					</xsl:for-each>
					
					<!--  Activity Locations -->
					<xsl:for-each select="rifcs:location">
						<xsl:call-template name="rifcs:location" />
					</xsl:for-each>
					
					<!--  Activity RelatedObjects -->
					<xsl:for-each select="rifcs:relatedObject">
						<xsl:call-template name="rifcs:relatedObject" />
					</xsl:for-each>
					
					<!--  Activity Subjects -->
					<xsl:apply-templates select="rifcs:subject"/>
										
					<!--  Activity Coverage -->
					<xsl:for-each select="rifcs:coverage">
						<xsl:call-template name="rifcs:coverage" />
					</xsl:for-each>
					
					<!--  Activity RelatedInfo -->
					<xsl:for-each select="rifcs:relatedInfo">
						<xsl:call-template name="rifcs:relatedInfo" />
					</xsl:for-each>
					
				</rdf:Description>
				
			</xsl:for-each>
		</rdf:RDF>
	</xsl:template>
	
	
	<!-- Related Objects and relationships in RIFCS items -->
	<!--http://ands.org.au/guides/cpguide/cpgrelatedobject.html-->
	
	<xsl:template name="rifcs:relatedObject">
		
		<xsl:variable name="object_id" select="rifcs:key"/>
		
		<xsl:choose>
			
			<!-- is overseen by the related party -->
			<!--  is maintained and made accessible by the related party -->
			<!--  is organised and/or delivered by the related party -->
			<xsl:when test="./rifcs:relation[@type= 'isManagedBy'] ">
				<ands:isManagedBy>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isManagedBy>				
			</xsl:when>	
			
			<xsl:when test="./rifcs:relation[@type = 'manages']">
				<ands:manages>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:manages>				
			</xsl:when>		
			
			<!-- oversees the related party or administers the related collection -->
			<xsl:when test="./rifcs:relation[@type = 'isManagerOf']">
				<ands:isManagerOf>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isManagerOf>				
			</xsl:when>	
			
			<xsl:when test="./rifcs:relation[@type = 'isAdministeredBy']">
				<ands:isAdministeredBy>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isAdministeredBy>				
			</xsl:when>	
			
			<xsl:when test="./rifcs:relation[@type = 'administers']">
				<ands:administers>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:administers>				
			</xsl:when>		
			
			<!--  legally belongs to the related party -->
			<xsl:when test="./rifcs:relation[@type = 'isOwnedBy']">
				<ands:isOwnedBy>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isOwnedBy>				
			</xsl:when>	
			
			<!--  legally possesses the related activity, collection, service or group -->
			<xsl:when test="./rifcs:relation[@type = 'isOwnerOf']">
				<ands:isOwnerOf>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isOwnerOf>				
			</xsl:when>
			
			<xsl:when test="./rifcs:relation[@type = 'owns']">
				<ands:owns>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:owns>		
			</xsl:when>
			
			<!--  is contained in the related service -->
			<!--  (group only) is contained in the related group -->
			<!--  is contained within the related collection -->
			<!--   is contained in the related activity -->
			<xsl:when test="./rifcs:relation[@type = 'isPartOf']">
				<ands:isPartOf>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isPartOf>				
			</xsl:when>
			
			<!--  contains the related service -->
			<!--  (group only) contains the related group -->
			<!--  contains the related collection -->
			<!--   contains the related activity -->
			<xsl:when test="./rifcs:relation[@type = 'hasPart']">
				<ands:hasPart>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:hasPart>
			</xsl:when>
			
			<!--  is enroled in the related group -->
			<xsl:when test="./rifcs:relation[@type = 'isMemberOf']">
				<ands:isMemberOf>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isMemberOf>
			</xsl:when>
			
			<!--(group only) has enroled the related party in the group -->
			<xsl:when test="./rifcs:relation[@type = 'hasMember']">
				<ands:hasMember>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:hasMember>
			</xsl:when>
			
			<xsl:when test="./rifcs:relation[@type = 'isAssociatedWith']">
				<ands:isAssociatedWith>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isAssociatedWith>
			</xsl:when>
			
			<!--  has an unspecified relationship with the related registry object -->
			<!--   has an undefined relationship with the related collection -->
			<!--   has an unspecified relationship with the related activity -->
			<xsl:when test="./rifcs:relation[@type = 'hasAssociationWith']">
				<ands:hasAssociationWith>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:hasAssociationWith>
			</xsl:when>
			
			<xsl:when test="./rifcs:relation[@type = 'funds']">
				<ands:funds>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:funds>
			</xsl:when>
			
			<!--  provides monetary or in-kind aid to the related party or activity -->
			<xsl:when test="./rifcs:relation[@type = 'isFunderOf']">
				<ands:isFunderOf>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isFunderOf>
			</xsl:when>
			
			<!--  receives monetary or in-kind aid from the related party or program -->
			<!--  receives monetary or in-kind aid from the related program -->
			<xsl:when test="./rifcs:relation[@type = 'isFundedBy']">
				<ands:isFundedBy>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isFundedBy>
			</xsl:when>
			<!--  is enroled in the related activity -->
			<xsl:when test="./rifcs:relation[@type = 'isParticipantIn']">
				<ands:isParticipantIn>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isParticipantIn>
			</xsl:when>
			
			<!--  is undertaken by the related party -->
			<xsl:when test="./rifcs:relation[@type= 'hasParticipant'] ">
				<ands:hasParticipant>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:hasParticipant>
			</xsl:when>
			
			<!--  is a product of the related activity -->
			<xsl:when test="./rifcs:relation[@type = 'isOutputOf']">
				<ands:isOutputOf>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isOutputOf>				
			</xsl:when>
			
			<!--  delivers materials in the related collection -->
			<xsl:when test="./rifcs:relation[@type= 'hasOutput'] ">
				<ands:hasOutput>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:hasOutput>
			</xsl:when>
			
			<!--  is held in the related repository -->
			<xsl:when test="./rifcs:relation[@type = 'isLocatedIn']">
				<ands:isLocatedIn>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isLocatedIn>
			</xsl:when>
			
			<!--  is the repository where the related collection is held -->
			<xsl:when test="./rifcs:relation[@type = 'isLocationFor']">
				<ands:isLocationFor>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isLocationFor>
			</xsl:when>
			
			<!--  is catalogued or indexed by the related collection -->
			<xsl:when test="./rifcs:relation[@type = 'isDescribedBy']">
				<ands:isDescribedBy>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isDescribedBy>
			</xsl:when>	
			
			<!--  is a catalogue for, or index of, of items in the related collection -->
			<xsl:when test="./rifcs:relation[@type = 'describes']">
				<ands:describes>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:describes>
			</xsl:when>	
			
			<!--  has been aggregated by the related party -->
			<xsl:when test="./rifcs:relation[@type = 'hasCollector']">
				<ands:hasCollector>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:hasCollector>
			</xsl:when>	
			
			<!--  has aggregated the related collection -->
			<xsl:when test="./rifcs:relation[@type = 'isCollectorOf']">
				<ands:isCollectorOf>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isCollectorOf>
			</xsl:when>	
			
			
			<!-- can be contributed to, accessed or used through the related service -->
			<xsl:when test="./rifcs:relation[@type = 'supports']">
				<ands:supports>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:supports>
			</xsl:when>	
			
			<!--   additional value provided to a collection by a party-->
			<xsl:when test="./rifcs:relation[@type = 'isEnrichedBy']">
				<ands:isEnrichedBy>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isEnrichedBy>
			</xsl:when>	
			
			<!--   collection is derived from the related collection, e.g. through analysis-->
			<xsl:when test="./rifcs:relation[@type = 'isDerivedFrom']">
				<ands:isDerivedFrom>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isDerivedFrom>
			</xsl:when>	
			
			<!--   the related collection is derived from the collection, e.g. through analysis-->
			<xsl:when test="./rifcs:relation[@type = 'hasDerivedCollection']">
				<ands:hasDerivedCollection>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:hasDerivedCollection>
			</xsl:when>	
			
			<!--  provides additional value to a collection-->
			<xsl:when test="./rifcs:relation[@type = 'enriches']">
				<ands:enriches>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:enriches>
			</xsl:when>	
			
			<!--  enables contribution and access to and use of the related collection -->
			<xsl:when test="./rifcs:relation[@type = 'isSupportedBy']">
				<ands:isSupportedBy>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isSupportedBy>
			</xsl:when>	
			
			<!-- isAvailableThrough ( specialisation of isSupportBy type - for Harvest, Search and Syndicate)-->
			<xsl:when test="./rifcs:relation[@type = 'isAvailableThrough']">
				<ands:isAvailableThrough>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isAvailableThrough>
			</xsl:when>	
			
			<!-- makesAvailable ( specialisation of supports type - for Harvest, Search and Syndicate)-->
			<xsl:when test="./rifcs:relation[@type = 'makesAvailable']">
				<ands:makesAvailable>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:makesAvailable>
			</xsl:when>	
			
			<!-- isProducedBy ( specialisation of isSupportBy type - for Create, Generate and Assemble)-->
			<xsl:when test="./rifcs:relation[@type = 'isProducedBy']">
				<ands:isProducedBy>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isProducedBy>
			</xsl:when>	
			
			<!-- produces ( specialisation of supports type - for Create, Generate and Assemble)-->
			<xsl:when test="./rifcs:relation[@type = 'produces']">
				<ands:produces>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:produces>
			</xsl:when>	
			
			<!-- isPresentedBy ( specialisation of isSupportBy type - for Report)-->
			<xsl:when test="./rifcs:relation[@type = 'isPresentedBy']">
				<ands:isPresentedBy>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isPresentedBy>
			</xsl:when>	
			
			<!-- presents ( specialisation of supports type - for Report)-->
			<xsl:when test="./rifcs:relation[@type = 'presents']">
				<ands:presents>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:presents>
			</xsl:when>	
			
			<!-- isOperatedOnBy ( specialisation of isSupportBy type - for Transform)-->
			<xsl:when test="./rifcs:relation[@type = 'isOperatedOnBy']">
				<ands:isOperatedOnBy>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:isOperatedOnBy>
			</xsl:when>	
			
			<!-- operatesOn ( specialisation of supports type - for Transform)-->
			<xsl:when test="./rifcs:relation[@type = 'operatesOn']">
				<ands:operatesOn>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:operatesOn>
			</xsl:when>	
			
			<!-- addsValueTo ( specialisation of isSupportBy type - for Annotate)-->
			<xsl:when test="./rifcs:relation[@type = 'addsValueTo']">
				<ands:addsValueTo>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:addsValueTo>
			</xsl:when>	
			
			<!-- hasValueAddedBy ( specialisation of supports type - for Annotate)-->
			<xsl:when test="./rifcs:relation[@type = 'hasValueAddedBy']">
				<ands:hasValueAddedBy>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="$object_id" /></xsl:attribute>
				</ands:hasValueAddedBy>
			</xsl:when>	
			
			
			
		</xsl:choose>
		
	</xsl:template>
	
	
	
	
	<!-- Description of RIFCS items -->
	<!-- http://ands.org.au/guides/cpguide/cpgsubject.html -->
	<xsl:template match="rifcs:subject">
		<xsl:variable name="rifcsSubjectTypeU" select="upper-case(normalize-space(@type))"/>
		<xsl:variable name="vivoPrefix"
			select="$type2prefix/m2r:map[@rifcsSubjectType=$rifcsSubjectTypeU]/@vivoPrefix"/>	
		
		<!-- Type: 
			'local'  ->  for uncontrolled terms such as keywords.
			,'anzsrc', -> The Australian and New Zealand Standard Research Classification
			'anzsrc-for',  -> Fields of Research
			'anzsrc-seo',  -> Socio-economic Objective
			'anzsrc-toa'  -> Type of Activity
		-->
		<xsl:if test="$vivoPrefix != ''">
			<vivo:subjectArea>
				<xsl:attribute name="rdf:resource" select="concat($vivoPrefix, .)"/> 
			</vivo:subjectArea>			
		</xsl:if>
	</xsl:template>	
	
	
	
	
	<!-- RelatedInfo of RIFCS items -->
	<!-- http://ands.org.au/guides/cpguide/cpgrelatedinfo.html -->
	<xsl:template name="rifcs:relatedInfo">
		
		<!-- Type: 
			'publication'  ->  for uncontrolled terms such as keywords.
			,'website', -> The Australian and New Zealand Standard Research Classification
		-->
		
		
		
		<!-- Identifier Type:
			
			'ark', -> ARK Persistent Identifier Scheme 
			'doi', -> Digital Object Identifier 
			'ean13', -> International Article Number
			'eissn', -> electronic International Standard Serial Number
			'handle', -> HANDLE System Identifier 
			'infouri', -> 'info' URI scheme 
			'local', -> identifer unique within a local context 
			'purl', -> Persistent Uniform Resource Locator 
			'uri', -> Uniform Resource Identifier 
			'issn', -> International Standard Serial Number
			'isbn', -> International Standard Book Number
			'istc', -> International Standard Text Code
			'lissn', -> linking ISSN (ISSN-L)
			'upc', -> Universal Product Code 
			'urn' -> Uniform Resource Name
			.
			
		-->
		<xsl:choose>
			<xsl:when test="@type = 'website'">
				<vivo:webpage><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</vivo:webpage>
			</xsl:when>
			
			<xsl:when test="@type = 'publication'">
				<ands:relatedInformationResource><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:relatedInformationResource>
			</xsl:when>
			
			
			
			<xsl:otherwise>
				<xsl:choose>
					
					<xsl:when test="./rifcs:identifier[@type = 'ark']">
						<ands:ark><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</ands:ark>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'doi']">
						<bibo:doi><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</bibo:doi>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'ean13']">
						<bibo:eanucc13><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</bibo:eanucc13></xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'eissn']">
						<bibo:eissn><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</bibo:eissn>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'handle']">
						<bibo:handle><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</bibo:handle>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'infouri']">
						<ands:infouri><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</ands:infouri>
					</xsl:when>
					
					<!--local-->
					<xsl:when test="./rifcs:identifier[@type = 'local']">
						<vivo:linkURI><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</vivo:linkURI>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'purl']">
						<ands:purl><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</ands:purl>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'uri']">
						<bibo:uri><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</bibo:uri>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'issn']">
						<bibo:issn><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</bibo:issn>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'isbn']">
						<bibo:isbn13><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</bibo:isbn13>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'istc']">
						<ands:istc><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</ands:istc>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'lissn']">
						<bibo:lissn><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</bibo:lissn>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'upc']">
						<bibo:upc><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</bibo:upc>
					</xsl:when>
					
					<xsl:when test="./rifcs:identifier[@type = 'urn']">
						<ands:urn><xsl:attribute name="rdf:resource"><xsl:value-of select="./rifcs:identifier" /></xsl:attribute>
						</ands:urn>
					</xsl:when>
					
				</xsl:choose>
			</xsl:otherwise>
			
		</xsl:choose>
		<!--
			<vivo:overview>
			<xsl:value-of select="."/>
			
			<type>
			<xsl:value-of select="@type"/>
			</type>
			
			</vivo:overview>
			
		-->
		
		<!--
			
			<xsl:template match="vivo:webpage">
			<xsl:variable name="resuri" select="@rdf:resource" />
			<xsl:variable name="linkURI"
			select="//rdf:Description[@rdf:about=$resuri]/vivo:linkURI" />
			<xsl:if test="$linkURI">
			<electronic type="url">
			<value>
			<xsl:value-of select="$linkURI" />
			</value>
			</electronic>
			</xsl:if>
			
		-->
		
		
		
		
		
		
		
	</xsl:template>	
	
	
	<!-- Location of RIFCS items -->
	<!-- http://ands.org.au/guides/cpguide/cpglocationintro.html -->
	<xsl:template name="rifcs:location">
		
		<!--
			Electronic Address
			
			@Type 'voice',
			'fax',
			'email',
			'other',
			'url',
			'wsdl'
		-->
			<xsl:choose>				
				<xsl:when test="./rifcs:address/rifcs:electronic[@type = 'fax']">
					<vivo:fax><xsl:value-of select="."/></vivo:fax>
				</xsl:when>				
				<xsl:when test="./rifcs:address/rifcs:electronic[@type = 'email']">
					<vivo:email><xsl:value-of select="."/></vivo:email>
				</xsl:when>
				<xsl:when test="./rifcs:address/rifcs:electronic[@type = 'other']">
					<bibo:uri><xsl:value-of select="."/></bibo:uri>
				</xsl:when>
				<xsl:when test="./rifcs:address/rifcs:electronic[@type = 'url']">
					<vivo:linkURI><xsl:value-of select="."/></vivo:linkURI>
				</xsl:when>
			    <xsl:when test="./rifcs:address/rifcs:electronic[@type = 'wsdl']">
					<ands:wsdl><xsl:value-of select="."/></ands:wsdl>
				</xsl:when>				
			</xsl:choose>	
		
		<!--
			<vivo:fax>
			
			</vivo:fax>
			
			<vivo:email>
			
			</vivo:email>
			
			<ands:wsdl>
			
			</ands:wsdl>
			
		-->
		
		<!--
			Physical Address
			
			@Type 'addressLine',
			'text',
			'telephoneNumber',
			'faxNumber'
			
		-->
		
		
		
		
		<xsl:choose>
			
			<xsl:when test="./rifcs:address/rifcs:physical/rifcs:addressPart[@type = 'streetAddress']">
				<vivo:addressStreet><xsl:value-of select="."/></vivo:addressStreet>				
			</xsl:when>
			
			<xsl:when test="./rifcs:address/rifcs:physical/rifcs:addressPart[@type = 'streetName']">
				<vivo:addressStreet><xsl:value-of select="."/></vivo:addressStreet>				
			</xsl:when>
			
			<xsl:when test="./rifcs:address/rifcs:physical/rifcs:addressPart[@type = 'addressLine']">
				<vivo:addressCity><xsl:value-of select="."/></vivo:addressCity>
			</xsl:when>
			
			<xsl:when test="./rifcs:address/rifcs:physical/rifcs:addressPart[@type = 'stateOrTerritory']">
				<vivo:addressState><xsl:value-of select="."/></vivo:addressState>
			</xsl:when>
			
			<xsl:when test="./rifcs:address/rifcs:physical/rifcs:addressPart[@type = 'country']">
				<vivo:addressCountry><xsl:value-of select="."/></vivo:addressCountry>
			</xsl:when>
			
			<xsl:when test="./rifcs:address/rifcs:physical/rifcs:addressPart[@type = 'postCode']">
				<vivo:addressPostalCode><xsl:value-of select="."/></vivo:addressPostalCode>
			</xsl:when>
			
		</xsl:choose>
		<!--
			Spatial
			
			@Type 'gmlkmlPolyCoords',
			'gpx',
			'iso31661',
			'iso31662',
			'iso19139dcmiBox',
			'kml',
			'kmlPolyCoords',
			'dcmiPoint',
			'text',
			'gml'
		-->
		<xsl:choose>
			
			<!-- TODO! missing iso31661 & iso31662 -->
			
			<xsl:when test="@type = 'gmlkmlPolyCoords'">
				<ands:gmlkmlPolyCoords>
					<xsl:value-of select="."/>
				</ands:gmlkmlPolyCoords>
			</xsl:when>	
			
			<xsl:when test="@type = 'gpx'">
				<ands:gpx>
					<xsl:value-of select="."/>
				</ands:gpx>
			</xsl:when>	
			
			
			<xsl:when test="@type = 'iso19139dcmiBox'">
				<ands:iso19139dcmiBox>
					<xsl:value-of select="."/>
				</ands:iso19139dcmiBox>
			</xsl:when>	
			
			<xsl:when test="@type = 'kml'">
				<ands:kml>
					<xsl:value-of select="."/>
				</ands:kml>
			</xsl:when>		
			
			<xsl:when test="@type = 'kmlPolyCoords'">
				<ands:kmlPolyCoords>
					<xsl:value-of select="."/>
				</ands:kmlPolyCoords>
			</xsl:when>			
			
			<xsl:when test="@type = 'dcmiPoint'">
				<ands:dcmiPoint>
					<xsl:value-of select="."/>
				</ands:dcmiPoint>
			</xsl:when>		
			
			
			<xsl:when test="@type = 'text'">
				<ands:text>
					<xsl:value-of select="."/>
				</ands:text>
			</xsl:when>
			
			
		</xsl:choose>
		
		
		
		
		
		
		
		
	</xsl:template>	
	
	
	<!-- Description of RIFCS items -->
	<!-- http://ands.org.au/guides/cpguide/cpgdescription.html -->
	<xsl:template name="rifcs:description">
		
		<!-- Type: 
			brief'  -> short account for selection purposes
			,'full', -> full account
			'logo',  -> symbol used as an identifying mark
			'note',  -> a brief informational message, not object metadata, to notify the record consumer of some important aspect regarding the object or its metadata
			'rights',  -> (collections only) information about rights held in and over the collection such as copyright, licenses and other intellectual property rights
			'accessRights',  -> (collections and services) information about access rights to the collection or service, including access restrictions based on privacy, security, or other policies
			'deliverymethod', -> (services only) information about how the service is delivered. Should be one of: webservice, software, offline, workflow
			'significanceStatement' ->  (collections only) a statement describing the significance of a collection within its domain or context
			
			
		-->
		<xsl:choose>
			
			<!--  short account for selection purposes -->
			<xsl:when test="@type = 'brief'">
				<vivo:description>
					<xsl:value-of select="."/>
				</vivo:description>				
			</xsl:when>
			
			<!--  full account -->
			<xsl:when test="@type = 'full'">
				<dcterms:description>
					<xsl:value-of select="."/>
				</dcterms:description>				
			</xsl:when>
			
			<!--  a brief informational message, not object metadata, to notify the record consumer of some important aspect regarding the object or its metadata -->
			<xsl:when test="@type = 'note'">
				<skos:note>
					<xsl:value-of select="."/>
				</skos:note>				
			</xsl:when>
			
			<!--  (collections only) information about rights held in and over the collection -->
			<xsl:when test="@type = 'rights'">
				<dcterms:rights>
					<xsl:value-of select="."/>
				</dcterms:rights>				
			</xsl:when>
			
			<!--  (collections and services) information about access rights to the collection or service -->
			<xsl:when test="@type = 'accessRights'">
				<dcterms:accessRights>
					<xsl:value-of select="."/>
				</dcterms:accessRights>				
			</xsl:when>
			
			<!--  (services only) information about how the service is delivered. Should be one of -->
			<xsl:when test="@type = 'deliverymethod'">
				<ands:deliverymethod>
					<xsl:value-of select="."/>
				</ands:deliverymethod>				
			</xsl:when>
			
			<!--  (collections only) a statement describing the significance of a collection within its domain or context -->
			<xsl:when test="@type = 'significanceStatement'">
				<ands:significanceStatement>
					<xsl:value-of select="."/>
				</ands:significanceStatement>				
			</xsl:when>
			
			
		</xsl:choose>
		
		<!--
			<vivo:overview>
			<xsl:value-of select="."/>
			
			</vivo:overview>
		-->
		
	</xsl:template>	
	
	
	
	<!-- Name /Title of RIFCS items-->
	<!-- http://ands.org.au/guides/cpguide/cpgname.html -->
	<xsl:template name="rifcs:name">
		<xsl:choose>
			<!--  TODO: personal name split into constituent elements 
				
				Name part type is only applicable to persons 
				<namePart type="title">Dr</namePart> 
				<namePart type="family">Smith</namePart> 
				<namePart type="given">Mary</namePart> 
				<namePart type="given">J</namePart> 
				<namePart type="suffix">OAM </namePart> 
				
			-->
			<xsl:when test="@type = 'title'">
				<vivo:preferredTitle>
					<xsl:value-of select="./rifcs:namePart"/>
				</vivo:preferredTitle>
			</xsl:when>
			
			<xsl:when test="@type = 'family'">
				<foaf:lastName>
					<xsl:value-of select="./rifcs:namePart"/>
				</foaf:lastName>
			</xsl:when>
			
			<xsl:when test="@type = 'given'">
				<xsl:choose>
					<xsl:when test="string-length(./rifcs:namePart/text()) = 1">
						
						<vivo:middleName>
							<xsl:value-of select="./rifcs:namePart"/>
						</vivo:middleName>
					</xsl:when>
					<xsl:otherwise>
						<foaf:firstName>
							<xsl:value-of select="./rifcs:namePart"/>
						</foaf:firstName>
					</xsl:otherwise>
				</xsl:choose>
				
			</xsl:when>
			
			<xsl:when test="@type = 'suffix'">
				<bibo:suffixName>
					<xsl:value-of select="./rifcs:namePart"/>
				</bibo:suffixName>
			</xsl:when>
			
			<xsl:when test="@type = 'primary'">
				<rdfs:label>
					<xsl:value-of select="./rifcs:namePart"/>					
				</rdfs:label>				
			</xsl:when>
			
			<!-- Inclusion of acronyms and abbreviations -->	
			<xsl:when test="@type = 'abbreviated'">
				<xsl:value-of select="./rifcs:namePart"/>				
			</xsl:when>
			
			<xsl:when test="@type = 'alternative'">				
				<xsl:value-of select="./rifcs:namePart"/>				
			</xsl:when>
			
			<xsl:otherwise>
				
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	
	
	<!-- date time of RIFCS items -->
	<xsl:template name="dateTime">
		
		<xsl:param name="publicationDate" />
		<xsl:param name="available" />
		<xsl:param name="created" />
		<xsl:param name="date" />
		<xsl:param name="dateAccepted" />
		<xsl:param name="dateSubmitted" />
		<xsl:param name="endPublicationDate" />
		<xsl:param name="dateIssued" />
		<xsl:param name="dateModified" />
		<xsl:param name="startPublicationDate" />
		<xsl:param name="dateVaild" />
		
		
		<xsl:if test="$publicationDate!=''">
			<xsl:attribute name="ands:publicationDate"><xsl:value-of select="$publicationDate"/></xsl:attribute>
		</xsl:if>
		
		<xsl:if test="$available!=''">
			<xsl:attribute name="ands:dateAvailable"><xsl:value-of select="$available"/></xsl:attribute>
		</xsl:if>
		
		<xsl:if test="$created!=''">
			<xsl:attribute name="ands:dateCreated"><xsl:value-of select="$created"/></xsl:attribute>
		</xsl:if>
		
		
		<xsl:if test="$date!=''">
			<xsl:attribute name="ands:date"><xsl:value-of select="$date"/></xsl:attribute>
		</xsl:if>
		
		<xsl:if test="$dateAccepted!=''">
			<xsl:attribute name="ands:dateAccepted"><xsl:value-of select="$dateAccepted"/></xsl:attribute>
		</xsl:if>
		
		<xsl:if test="$dateSubmitted!=''">
			<xsl:attribute name="ands:dateSubmitted"><xsl:value-of select="$dateSubmitted"/></xsl:attribute>
		</xsl:if>
		
		<xsl:if test="$endPublicationDate!=''">
			<xsl:attribute name="ands:endPublicationDate"><xsl:value-of select="$endPublicationDate"/></xsl:attribute>
		</xsl:if>
		
		<xsl:if test="$dateIssued!=''">
			<xsl:attribute name="ands:dateIssued"><xsl:value-of select="$dateIssued"/></xsl:attribute>
		</xsl:if>
		
		<xsl:if test="$dateModified!=''">
			<xsl:attribute name="ands:dateModified"><xsl:value-of select="$dateModified"/></xsl:attribute>
		</xsl:if>
		
		
		<xsl:if test="$startPublicationDate!=''">
			<xsl:attribute name="ands:startPublicationDate"><xsl:value-of select="$startPublicationDate"/></xsl:attribute>
		</xsl:if>
		
		
		<xsl:if test="$dateVaild!=''">
			<xsl:attribute name="ands:dateVaild"><xsl:value-of select="$dateVaild"/></xsl:attribute>
		</xsl:if>
		
		
	</xsl:template>
	
	
	
	<!-- Identifier of RIFCS items -->
	<!-- http://ands.org.au/guides/cpguide/cpgidentifiers.html -->
	<xsl:template name="rifcs:identifier">
		<xsl:choose>
			<!-- Type: 
				'AU-ANL:PEAU'  -> National Library of Australia party identifier 
				,'abn', -> Australian Business Number 
				'arc',  ->  Australian Research Council identifier - identifiers issued by or on behalf of the Australian Research Council.
				'ark',  -> ARK Archival Resource Key, a persistent identifier scheme from the California Digital Library at the University of California.
				'doi',  -> Digital Object Identifier Name 
				'handle',  -> HANDLE System Identifier
				'infouri', ->  'info' URI scheme - administered by OCLC on behalf of NISO.
				'isil' ->  International Standard Identifier for Libraries and Related Organizations
				'local' ->  identifier unique within a local context
				'purl' -> Persistent Uniform Resource Locator see also National Library of Australia use of purl 
				'uri'  ->  Uniform Resource Identifier -a compact sequence of characters that identifies an abstract or physical resource.
				'txt' -> text
			-->
			
			
			<xsl:when test="@type = 'AU-ANL:PEAU'">	
				<ands:nla><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:nla>
			</xsl:when>
			
			<xsl:when test="@type = 'abn'">
				<ands:abn><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:abn>
			</xsl:when>
			
			<xsl:when test="@type = 'arc'">
				<ands:arc><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:arc>
			</xsl:when>
			
			<xsl:when test="@type = 'ark'">
				<ands:ark><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:ark>
			</xsl:when>
			
			<xsl:when test="@type = 'doi'">
				<bibo:doi><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</bibo:doi>
			</xsl:when>
			
			<xsl:when test="@type = 'handle'">
				<bibo:handle><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</bibo:handle></xsl:when>
			
			<xsl:when test="@type = 'infouri'">
				<ands:infouri><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:infouri>
			</xsl:when>
			
			<xsl:when test="@type = 'isil'">
				<ands:isil><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:isil>
			</xsl:when>
			
			<xsl:when test="@type = 'local'">
				<vivo:linkURI><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</vivo:linkURI>		
			</xsl:when>
			
			<xsl:when test="@type = 'purl'">
				<ands:purl><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:purl>
			</xsl:when>
			
			<xsl:when test="@type = 'uri'">
				<ands:uri><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:uri>
			</xsl:when>
			
			<xsl:otherwise>
				<!--
					<ands:text>
					<xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
					</ands:text>
				-->
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>	
	
	
	
	<!-- Citation of RIFCS items -->
	<xsl:template name="rifcs:citation">
		<xsl:choose>
			<xsl:when test="@type = 'Harvard'">	
				<ands:citHarvard><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citHarvard>
			</xsl:when>
			
			<xsl:when test="@type = 'APA'">	
				<ands:citAPA><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citAPA>
			</xsl:when>
			
			<xsl:when test="@type = 'MLA'">	
				<ands:citMLA><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citMLA>
			</xsl:when>
			
			<xsl:when test="@type = 'Vancouver'">	
				<ands:citVancouver><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citVancouver>
			</xsl:when>
			
			<xsl:when test="@type = 'IEEE'">	
				<ands:citIEEE><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citIEEE>
			</xsl:when>
			
			<xsl:when test="@type = 'CSE'">	
				<ands:citCSE><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citCSE>
			</xsl:when>
			
			<xsl:when test="@type = 'Chicago'">	
				<ands:citChicago><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citChicago>
			</xsl:when>
			
			<xsl:when test="@type = 'AMA'">	
				<ands:citAMA><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citAMA>
			</xsl:when>
			
			<xsl:when test="@type = 'AGPS-AGIMO'">	
				<ands:citAGPS-AGIMO><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citAGPS-AGIMO>
			</xsl:when>
			
			<xsl:when test="@type = 'AGLC'">	
				<ands:citAGLC><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citAGLC>
			</xsl:when>
			
			<xsl:when test="@type = 'ACS'">	
				<ands:citACS><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citACS>
			</xsl:when>
			
			<xsl:when test="@type = 'Datacite'">	
				<ands:citDatacite><xsl:attribute name="rdf:resource"><xsl:value-of select="." /></xsl:attribute>
				</ands:citDatacite>
			</xsl:when>
		</xsl:choose>
	</xsl:template>
		
	<xsl:template name="rifcs:accessPolicy">
		
		<vivo:accessPolicy>
			<xsl:value-of select="."/>
		</vivo:accessPolicy>
	</xsl:template>	
	
	<xsl:template name="rifcs:coverage">
		
		<ands:coverage>
			<xsl:for-each select="rifcs:temporal/rifcs:text">
				
				<xsl:choose>
					<xsl:when test="contains(text(), 'start date')">
						<xsl:call-template name="dateTime" >
							<xsl:with-param name="startPublicationDate">
								<xsl:value-of select="text()"/>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>
					
					<xsl:when test="contains(text(), 'end date')">
						<xsl:call-template name="dateTime" >
							<xsl:with-param name="endPublicationDate">
								<xsl:value-of select="text()"/>
							</xsl:with-param>
						</xsl:call-template>
					</xsl:when>
					
				</xsl:choose>
		
			</xsl:for-each>
			
		</ands:coverage>
	</xsl:template>	
	
	
</xsl:stylesheet>



